<?php
class Lib_Security extends Zend_Controller_Plugin_Abstract {
	public static function checkPermission($User, $request) {
		$action = $request ['action'];
		$module = $request ['module'];
		$controller = $request ['controller'];
		
		$UserGroup = $User->UserGroup;
		$ListPer = UserGroupPermission::getAllWithoutPager ( array (
				'group_id=?' => $UserGroup->id 
		) );
		if($ListPer->count()>0){
			foreach ( $ListPer as $Per ) {
				if ($Per->Permission->module == $module && $Per->Permission->controller == $controller && $Per->Permission->action == $action) {
					return true;
				}
			}
		}
		
		return false;
	}
}